package com.youcash.ZyWallet_spring.service.impl;

import com.youcash.ZyWallet_spring.dao.PaymentMethodMapper;
import com.youcash.ZyWallet_spring.entity.PaymentMethod;
import com.youcash.ZyWallet_spring.service.PaymentMethodService;
import com.youcash.ZyWallet_spring.vo.ResStatus;
import com.youcash.ZyWallet_spring.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class PaymentMethodServiceImpl implements PaymentMethodService {

    @Autowired
    PaymentMethodMapper paymentMethodMapper;

    @Override
    public ResultVO listMethod() {
        Example example = new Example(PaymentMethod.class);
        List<PaymentMethod> paymentMethods = paymentMethodMapper.selectByExample(example);
        if (paymentMethods.size() == 0) {
            return new ResultVO(ResStatus.NO, "查询失败！", null);
        } else {
            return new ResultVO(ResStatus.OK, "查询成功！", paymentMethods);
        }
    }
}
